package org.demis.dwarf.core.object;

import java.util.HashMap;
import java.util.Map;

public class ManyToOne {

    private Entity associatedEntity = null;

    private Entity owner;

    private Map<RawAttribute, RawAttribute> associatedAttributes = new HashMap<RawAttribute, RawAttribute>();

    public ManyToOne() {
        // no op
    }

    public Entity getAssociatedEntity() {
        return associatedEntity;
    }

    public void setAssociatedEntity(Entity associatedEntity) {
        this.associatedEntity = associatedEntity;
    }

    public Entity getOwner() {
        return owner;
    }

    public void setOwner(Entity owner) {
        this.owner = owner;
    }

    public Map<RawAttribute, RawAttribute> getAssociatedAttributes() {
        return associatedAttributes;
    }

    public void setAssociatedAttributes(Map<RawAttribute, RawAttribute> associatedAttributes) {
        this.associatedAttributes = associatedAttributes;
    }

    public void addAssociatedAttributes(RawAttribute attribute, RawAttribute target) {
        associatedAttributes.put(attribute, target);
    }

    public RawAttribute getTargetAttribute(RawAttribute attribute) {
        return associatedAttributes.get(attribute);
    }
}
